package com.wallet.crypto.trustapp.ui.setting;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.wallet.crypto.trustapp.R;
import com.wallet.crypto.trustapp.ui.BaseActivity;
import com.wallet.crypto.trustapp.ui.widget.adapter.CurrencyUnitAdapter;
import com.wallet.crypto.trustapp.ui.widget.adapter.VirtuaCurrencyAdapter;
import com.wallet.crypto.trustapp.ui.widget.entity.CurrencyUnit;
import com.wallet.crypto.trustapp.ui.widget.entity.VirtuaCurrencyItem;
import com.wallet.crypto.trustapp.widget.SpacesItemDecoration;

import java.util.ArrayList;

/**
 * 显示虚拟货币
 */
public class InSettingVirtualActivity extends BaseActivity {

    private int[] UNIT = {R.string.s0010, R.string.s0011,R.string.s0012};

    private final ArrayList<VirtuaCurrencyItem> mItems = new ArrayList<>();

    private ImageView mClose;
    private TextView mTitle;
    private RecyclerView mRecyclerView;
    private VirtuaCurrencyAdapter mAdapter;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);
        initView();
    }

    private void initView() {
        mClose = findViewById(R.id.top_icon);
        mTitle = findViewById(R.id.top_title);
        mTitle.setVisibility(View.VISIBLE);
        mTitle.setText(R.string.s0006);
        mRecyclerView = findViewById(R.id.setting_rev);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.addItemDecoration(new SpacesItemDecoration(10));
        mClose.setOnClickListener(this::OnCloseListener);
        initData();
        mAdapter = new VirtuaCurrencyAdapter(this,mItems);
        mRecyclerView.setAdapter(mAdapter);
    }

    private void initData() {
        mItems.add(new VirtuaCurrencyItem(UNIT[0]));
        mItems.add(new VirtuaCurrencyItem(UNIT[1]));
        mItems.add(new VirtuaCurrencyItem(UNIT[2]));

    }
    private void OnCloseListener(View view) {
        finish();
    }
}
